<template>
  <div class="content">
    <Tabs :text="text">
      <Search @data="upState" @easySearch="easySearch" />
    </Tabs>
    <SearchItem v-if="state"></SearchItem>
    <router-view></router-view>
  </div>
</template>

<script>
import Search from "../../components/Search.vue";
import Tabs from "../../components/Tabs.vue";
import SearchItem from "../../components/SearchItem.vue";
import { mapMutations } from "vuex";
export default {
  name: "Home",
  components: {
    Search,
    Tabs,
    SearchItem,
  },
  data() {
    return {
      text: [
        {
          id: "1",
          textName: "客户列表",
          url: "/home/userlist",
        },
        {
          id: "2",
          textName: "今日新增",
          url: "/home/useraddday",
        },
        {
          id: "3",
          textName: "本周新增",
          url: "/home/useraddweek",
        },
        {
          id: "4",
          textName: "本月新增",
          url: "/home/useraddmonth",
        },
        // {
        //   id: "5",
        //   textName: "撞单查询",
        //   url: "/home/collisioninquiry",
        // },
        {
          id: "6",
          textName: "新增客户",
          url: "/home/adduser?id=1",
        },
        // {
        //   id: "7",
        //   textName: "自定义设置",
        //   url: "/home/customsettings",
        // },
        // {
        //   id: "8",
        //   textName: "保护期设置",
        //   url: "/home/protectionperiodsetting",
        // },
      ],
      state: false,
    };
  },
  methods: {
    ...mapMutations(["userManage/fixSearchVal"]),
    upState(data) {
      this.state = !data; //状态处理
    },
    easySearch(val) {
      this["userManage/fixSearchVal"](val);
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  width: 100%;
  height: 728px;
}
</style>
